#include<iostream>
#include<algorithm>
#include<functional>
#include<iterator>
using namespace std;

int get_pos(int arr[], int val, int len){

    for(int i=0;i<len;i++){
        if(arr[i]==val) return i;
    }

    return -1;
}

int main(){
    int a[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
    cout << get_pos(a,3,8)  << endl;
    int b[8];
    copy(a,a+8,b);
    reverse(a,a+8);
    cout << get_pos(a,3,8) << endl;
    copy(a,a+8,ostream_iterator<int> (cout, " "));
    cout<<endl;
    copy(b,b+8,ostream_iterator<int> (cout," "));

    return 0;
}

